<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="com.anhry.app.safety.util.Util"/>
<%@ include file="/WEB-INF/pages/share/taglib.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title> 隐患排查标准导入</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="<%=basePath+Util.SKIN%>/css/right.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<%=basePath%>/js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/jquery.form.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/check_jquery.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/multipleBox.js"></script>
	<script type="text/javascript">		
		function checkMultiple(){
			var dbfile=document.getElementById("dbFile");
			if(dbfile.value==null||dbfile.value==""){
				alert("请点击“浏览”上传Excel附件！");
				dbfile.focus();
				return false;
			}
			var selectBox = document.getElementById('haveSelect');
			var haveSelect = "";
			if(selectBox.options != null && selectBox.options.length != 0){
				for(var i=0;i<selectBox.options.length;i++){
					var tKey = selectBox.options[i].value;
					haveSelect += tKey + ","; 					
				}
				if(haveSelect.length>0){
					haveSelect = haveSelect.substring(0,haveSelect.length-1);
				}
			}
			document.form1.objIds.value=haveSelect;
			document.form1.action = "<%=basePath%>/zczb/bzh_save.action";
			$("#btnSubmit2").val("正在提交...");
			document.form1.submit();
		}
		
		$(function() {
			$("#btnSubmit1").click(function() {
					var dbfile=document.getElementById("dbFile");
					
					if(dbfile.value==null||dbfile.value==""){
						alert("请点击“浏览”上传Excel附件！");
						dbfile.focus();
						return false;
					} else {
					$("#btnSubmit1").val("校验中...");
						var options = { 
								//target:'#tip', //后台将把传递过来的值赋给该元素 
								url:'<%=basePath%>/zczb/bzh_validateAttachment.action', //提交给哪个执行 
								type:'POST', 
								/*beforeSubmit:function(formData, jqForm, options) {
									var queryStr = $.param(formData);
									alert(queryStr);
									return true;
								},*/
								success: function(data){ 
									//alert(data);  
									$("#tip").html("提示: " + data);
									if(data == "校验成功!") {
										$("#btnSubmit1").val("通过");
										$("#btnSubmit1").attr("disabled","disabled");
										$("#btnSubmit2").removeAttr("disabled");
									} else {
											$("#btnSubmit1").val("校 验");
									}
								},
					            error: function (msg) {
					                $("#tip").html("提示: 文件校验失败");    
					            }  
								}; 
						//ajax 方式提交表单  这里只是注册了函数
						$("#form1").submit(function() {
							
							$('#form1').ajaxSubmit(options); 
							return false;
						});
					//表单提交
					$("#form1").submit();
				}
			});
		});
	</script>
  </head>
  
  <body>
	<div  class="body-box">
		<div class="map">
			<div class="map_con">
				您当前的位置：自查自报 &gt; 隐患排查标准管理 &gt; 隐患排查标准导入
			</div>
		</div>
		<div id="container">
			<form action="<%=basePath%>/zczb/bzh_save.action" method="post" name="form1" id="form1"  enctype="multipart/form-data" target="_self">
		    	<table border="0" cellspacing="0" cellpadding="0"  width="100%" class="info_table">
					<tr>
						<td colspan="2" class="title_li">隐患排查标准导入</td>
					</tr>
					<tr><td colspan="2"><div id="tip" style="color:red;"></div></td></tr>
					<tr>
						<td class="title_td" width="15%">附件：</td>
						<td>
							<input type="file" name="dbFile" id="dbFile" onkeypress="return false;"><span style="color: gray">只能上传excel格式！</span>
						</td>
					</tr>
					<tr>
						<td class="title_td">对应企业类型：</td>
							<td>
								<table border="0" cellspacing="0" cellpadding="0"  width="100%"  style="float:left;">
								<tr>
									<td width="45%" style="border:none">
									  所有企业类型：<br>
										 <table width="99%" height="200" border="0" cellpadding="1" cellspacing="0" bgcolor="#F7F7F7" style="font-size:10pt">
											  <tr height="100%">
												<td width="100%" height="100%" align="left" valign="middle">
													<select style="width:100%;height:100%" name="allSelect" size="17" ondblclick="selectMove(document.form1.allSelect,document.form1.haveSelect,'左')">																		                                      	
				                                    	<s:if test="typeList.size>0">
				                                    	<s:iterator id="obj" value="typeList">
				                                      		<option value="${obj.id }">
				                                      			${obj.typeParentName }——${obj.typeName}
				                                      		</option>	
				                                      	</s:iterator>
				                                      	</s:if>
				                                    </select>
			                                    </td>
											  </tr>
										</table>
									</td>
									<td width="10%" style="text-align:center;border-top:none;border-bottom:none;"><br>
								    <a href="javascript:selectMove(document.form1.allSelect,document.form1.haveSelect,'左')">添加</a><br>
								    <a href="javascript:selectMove(document.form1.haveSelect,document.form1.allSelect,'右')">删除</a><br>
								    <a href="javascript:moveAll(document.form1.allSelect,document.form1.haveSelect);">全部添加</a><br>
								    <a href="javascript:moveAll(document.form1.haveSelect,document.form1.allSelect);">全部删除</a></td>
									<td width="45%" style="border:none">
									  对应企业类型：<br>
										 <table width="99%" height="200" border="0" cellpadding="1" cellspacing="0" bgcolor="#F7F7F7" style="font-size:10pt">
											  <tr height="100%">
												<td width="100%" height="100%" align="left" valign="middle">
													<select id="haveSelect" style="width:100%;height:100%" name="haveSelect" size="17" ondblclick="selectMove(document.form1.haveSelect,document.form1.allSelect,'右')" >											                                     
				                                    	
				                                    </select>
			                                    </td>
											  </tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td colspan="4" align="center">
							<center>
							<input type="button" name="btntj" class="link_input" id="btnSubmit1" value="校 验" alt="检查标准格式是否正确">
							<input type="button" name="btntj" class="link_input" id="btnSubmit2" value="提 交" disabled="disabled" onclick="checkMultiple();">
							<input type="button" name="btn1" class="link_input" id="btnset1" value="返 回" onclick="window.location.href='<%=basePath%>/zczb/bzh_list.action'">
							</center>
						</td>
					</tr>
				</table>
				<input type="hidden" name="objIds" value=""/>
			</form>
		</div>
	</div>
  </body>

</html>
